import { createRouter, createWebHistory } from "vue-router"
import HomeIndex from '@/views/home/HomeIndex.vue'
import AboutIndex from '@/views/about/AboutIndex.vue'
import NewsIndex from '@/views/news/NewsIndex.vue'
import NewsDetail from '@/views/news/NewsDetail.vue'
import CasesIndex from '@/views/cases/CasesIndex.vue'
import ContactIndex from '@/views/about/ContactIndex.vue'
import FeedbackIndex from '@/views/feedback/FeedbackIndex.vue'
import SolutionsIndex from '@/views/solutions/SolutionsIndex.vue'
import ConsultIndex from '@/views/consult/ConsultIndex.vue'

const routes = [
  {
    path: '/',
    name: 'Home',
    component: HomeIndex
  },
  {
    path: '/about',
    name: 'About',
    component: () => import('@/views/about/AboutIndex.vue'),
    children: [
      {
        path: 'contact',
        name: 'Contact',
        component: () => import('@/views/about/ContactIndex.vue'),
        meta: {
          title: '联系我们'
        }
      },
      {
        path: 'feedback',
        name: 'Feedback',
        component: () => import('@/views/feedback/FeedbackIndex.vue'),
        meta: {
          title: '意见反馈'
        }
      }
    ]
  },
  {
    path: '/news',
    name: 'News',
    component: NewsIndex
  },
  {
    path: '/news/:id',
    name: 'NewsDetail',
    component: NewsDetail,
    props: true
  },
  {
    path: '/cases',
    name: 'Cases',
    component: CasesIndex
  },
  {
    path: '/feedback',
    name: 'Feedback',
    component: FeedbackIndex
  },
  {
    path: '/solutions',
    name: 'Solutions',
    component: SolutionsIndex
  },
  {
    path: '/consult',
    name: 'Consult',
    component: ConsultIndex
  }
]

const router = createRouter({
  history: createWebHistory(),
  routes
})

export default router

